Skip to content

Refactoring the UI for consistent styling#776

Merged
sean-esk merged 2 commits intomainfrom
refactor/knowledge-ui
Oct 10, 2025
Merged

Refactoring the UI for consistent styling#776
sean-esk merged 2 commits intomainfrom
refactor/knowledge-ui

Conversation

@sean-esk
Copy link
Copy Markdown
Collaborator

@sean-esk sean-esk commented Oct 10, 2025

Pull Request

Summary

Comprehensive refactor of Knowledge Base feature to align with UI_STANDARDS.md, replacing custom styling with centralized primitives, improving accessibility, and enhancing document/code viewing with markdown rendering and syntax highlighting.

Changes Made

  • Refactored 15+ Knowledge Base components to use DataCard, TabsList/TabsTrigger, and glassCard primitives
  • Removed ~200 lines of duplicate custom styling code
  • Replaced visible border line artifacts with proper glassCard.edgeLit effects
  • Added markdown rendering (ReactMarkdown) for document content with custom component styling
  • Added syntax highlighting (Prism.js) for code examples with error handling
  • Made KnowledgeHeader responsive with 2-row layout (title + button / search + filters)
  • Added responsive breakpoint to LevelSelector (grid-cols-2 sm:grid-cols-4)
  • Added 15 missing dark mode variants across all components
  • Fixed 11 line length violations (split to <120 chars)
  • Removed dead code: DocumentBrowser.tsx (unused, only in style-guide examples)
  • Fixed TypeScript errors in useKnowledgeQueries.ts and KnowledgeView.tsx
  • Added safe date formatting with error handling in KnowledgeTable
  • Added helper function for hostname parsing in KnowledgeTable
  • Fixed text truncation in KnowledgeTable with inline-block
  • Added keyboard accessibility: focus-visible rings, proper button elements for tooltips
  • Stripped outer backticks from document content to fix code-block rendering issue
  • Improved modal UX: moved help text inline with labels, removed redundant descriptions

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring

Affected Services

  • Frontend (React UI)
  • Server (FastAPI backend)
  • MCP Server (Model Context Protocol)
  • Agents (PydanticAI service)
  • Database (migrations/schema)
  • Docker/Infrastructure
  • Documentation site

Testing

  • All existing tests pass
  • Added new tests for new functionality
  • Manually tested affected user flows
  • Docker builds succeed for all services

Test Evidence

# TypeScript validation
npx tsc --noEmit 2>&1 | grep "src/features/knowledge" | grep -v "tests/" | wc -l
# Result: 0 errors

# Biome linting
npm run biome
# Result: Clean (only pre-existing safe warnings)

# Dark mode compliance
grep -rn "bg-.*-[0-9]" src/features/knowledge --include="*.tsx" | grep -v "dark:" | grep -v "gradient-to" | wc -l
# Result: 0 violations

# Line length compliance
grep -rn ".\{121,\}" src/features/knowledge --include="*.tsx" | grep className | wc -l
# Result: 0 violations

# UI Standards Review
Score: 10/10 (Perfect A)
Report: PRPs/reviews/ui-consistency-review-knowledge.md

Checklist

  • My code follows the service architecture patterns
  • If using an AI coding assistant, I used the CLAUDE.md rules
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass locally
  • My changes generate no new warnings
  • I have updated relevant documentation
  • I have verified no regressions in existing features

Breaking Changes

None. This is a pure refactoring - all functionality remains identical.

Additional Notes

UI Standards Compliance

  • Before: 9/10 (Grade A) - 4 high-priority violations, 1 medium
  • After: 10/10 (Perfect A) - Zero violations

Code Quality Improvements

  • Removed ~200 lines of duplicate styling code
  • All components now use centralized glassCard utilities from styles.ts
  • Zero dynamic class construction (Tailwind v4 compliant)
  • 100% dark mode coverage
  • Full keyboard accessibility (focus-visible rings, proper ARIA)

Visual Enhancements

  • Knowledge cards use DataCard primitive with proper top edge-lit effect
  • Type/Level selectors have subtle top glow (no visible border lines)
  • Add Knowledge dialog uses standard TabsList/TabsTrigger pills (centered, compact)
  • Document content renders as formatted markdown (headers, lists, bold, links styled in cyan/purple theme)
  • Code examples have Prism.js syntax highlighting with cyan-themed colors
  • Responsive header wraps search/filters on smaller screens
  • Button text simplified: "Knowledge" instead of "Add Knowledge"

Dependencies Added

  • @types/prismjs (devDependency) - TypeScript types for Prism syntax highlighter

Files Modified (17)

Components:

  • AddKnowledgeDialog.tsx
  • KnowledgeCard.tsx
  • KnowledgeCardTags.tsx
  • KnowledgeCardType.tsx
  • KnowledgeHeader.tsx
  • KnowledgeList.tsx
  • KnowledgeTable.tsx
  • KnowledgeTypeSelector.tsx
  • LevelSelector.tsx
  • TagInput.tsx
  • index.ts (removed DocumentBrowser export)

Inspector:

  • ContentViewer.tsx
  • InspectorHeader.tsx
  • InspectorSidebar.tsx

Hooks:

  • useKnowledgeQueries.ts

Views:

  • KnowledgeView.tsx

Primitives:

  • switch.tsx

Files Deleted (1)

  • DocumentBrowser.tsx (dead code - only used in style-guide examples)

PRPs Completed

  • PRPs/story_knowledge base_ui_refactor_style_guide_compliance.md
  • PRPs/story_knowledge_ui_polish_fixes.md

CodeRabbit Review

All issues addressed:

  • ✅ Removed cursor-pointer from non-clickable table rows
  • ✅ Changed Info tooltip trigger to focusable button element
  • ✅ Installed @types/prismjs, removed @ts-ignore
  • ✅ Added try-catch error handling to Prism.highlight()
  • ✅ Extracted duplicate language detection logic

Screenshots

Markdown rendering now shows formatted headers, lists, and styled elements in cyan/purple theme. Code examples display with syntax highlighting and cyan glow border.

Summary by CodeRabbit

  • New Features

    • Content viewer now renders Markdown and syntax-highlighted code with copy feedback.
    • Knowledge table redesigned with richer columns (source, type, counts, created) and streamlined actions (view, delete).
  • Style

    • Unified "glass" visuals across dialogs, selectors, tags, and cards with updated color tokens.
    • Broad dark-mode enhancements across headers, lists, inspector, and status indicators.
  • Refactor

    • Add Knowledge dialog uses native tabs; header adopts a responsive two-row layout.
    • Various cards, selectors, and inputs consolidated to shared style tokens for consistent UI.
  • Removed

    • The Document Browser dialog/component and its export were removed.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 10, 2025

Walkthrough

Refactors knowledge UI to use glassCard/DataCard styles and native Tabs, removes DocumentBrowser and its re-export, enhances ContentViewer with Prism + ReactMarkdown and a new copiedId prop, extends optimistic mutation contexts with tempItemId, adds dark-mode variants, and adjusts package devDeps and minor primitive formatting.

Changes

Cohort / File(s) Summary
Package metadata
archon-ui-main/package.json
Dev-only dependency edits: @types/prismjs added; transient Tailwind devDeps were added then removed in the diff. No runtime dependencies changed.
Add knowledge & tabbing UI
.../features/knowledge/components/AddKnowledgeDialog.tsx, .../KnowledgeTypeSelector.tsx, .../LevelSelector.tsx, .../TagInput.tsx
Replace custom tab/buttons with native Tabs (TabsList/TabsTrigger); migrate to glassCard/glass styling tokens; simplify class composition; update selection/edge-lit visuals and tooltip structure; functional APIs unchanged.
Card/list/table UI
.../KnowledgeCard.tsx, .../KnowledgeCardTags.tsx, .../KnowledgeCardType.tsx, .../KnowledgeList.tsx, .../KnowledgeHeader.tsx, .../KnowledgeTable.tsx
Swap to DataCard/DataCardHeader/Content/Footer, consolidate edgeColor mapping, add dark-mode variants, two-row header layout, rebuild table with helpers (getHostname, isSafeProtocol, formatCreatedDate), richer columns, per-row actions (view/delete) and isDeleting state.
Inspector & content rendering
.../inspector/components/ContentViewer.tsx, .../InspectorHeader.tsx, .../InspectorSidebar.tsx
Add Prism syntax-highlighting and ReactMarkdown rendering; new highlight/strip helpers; expose copiedId prop on ContentViewer; update badges and sidebar/hover styling for dark mode.
Knowledge hooks (optimistic updates)
.../features/knowledge/hooks/useKnowledgeQueries.ts
Extend optimistic onMutate return/context for crawl and upload mutations to include tempItemId alongside tempProgressId; mutation types/signatures updated accordingly.
Removed component & exports
.../features/knowledge/components/DocumentBrowser.tsx, .../features/knowledge/components/index.ts
Remove DocumentBrowser component file and its re-export from index.
View logic tweaks
.../features/knowledge/views/KnowledgeView.tsx
Simplify operation error fallback from `op.message
UI primitive minor formatting
.../features/ui/primitives/switch.tsx
Formatting/parameter-list changes in forwardRef render signature and a trailing comma in deps; no behavioral changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as AddKnowledgeDialog
  participant Hooks as useKnowledgeQueries
  participant Server

  rect rgba(220,245,255,0.35)
  note right of UI: User triggers optimistic crawl/upload
  User->>UI: Click "Crawl" / "Upload"
  UI->>Hooks: mutate(payload)
  Hooks->>Hooks: onMutate -> create tempProgressId & tempItemId
  Hooks-->>UI: return { tempProgressId, tempItemId }
  UI->>User: Render optimistic item/progress
  end

  Hooks->>Server: POST /crawl or /upload
  alt success
    Server-->>Hooks: 200 {id,...}
    Hooks->>Hooks: replace temp ids with real id, update cache
    Hooks-->>UI: onSuccess (cache update)
    UI->>User: Show confirmed item
  else error
    Server-->>Hooks: 4xx/5xx
    Hooks-->>UI: onError (rollback using returned context)
    UI->>User: Show error/rollback
  end
Loading
sequenceDiagram
  autonumber
  participant Sidebar as InspectorSidebar
  participant CV as ContentViewer
  participant Prism as Prism
  participant MD as ReactMarkdown

  Sidebar->>CV: select item {type, content, metadata, copiedId}
  alt Code item
    CV->>CV: detect language (metadata or fallback)
    CV->>Prism: highlight(code, lang)
    Prism-->>CV: highlighted HTML
    CV->>User: render highlighted code block
  else Document/Markdown
    CV->>CV: stripOuterBackticks(content)
    CV->>MD: render(markdown)
    MD-->>CV: React nodes
    CV->>User: render markdown content
  end
  User->>CV: Click Copy
  CV->>Sidebar: onCopy(text, id)
  Sidebar-->>CV: copiedId updated (show "Copied!")
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • coleam00
  • Wirasm

Poem

I hop through tabs of glass and light,
Edge-lit cards gleam in morning bright.
Prism paints code, Markdown sings,
Temp IDs dance on hopeful springs.
Confirmed at last — the knowledge springs. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title accurately highlights the primary change—refactoring the UI for consistent styling—and directly reflects the main effort of standardizing component styles using centralized primitives. It avoids extraneous detail while clearly conveying the purpose of the changeset. This concise phrasing will be informative for team members reviewing commit history.
Description Check ✅ Passed The description fully adheres to the repository’s template by providing a summary, detailed list of changes, type of change, affected services, testing procedures with evidence, a checklist, and breaking-changes statement. All required sections are present and clearly filled out, and additional contextual notes further enhance clarity. This structure ensures reviewers have all necessary information without gaps.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/knowledge-ui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts (1)

307-316: Fix mutation context type for upload to include tempItemId

onMutate returns tempItemId, but the context type doesn’t declare it. This breaks strict TS. Add tempItemId: string to the 4th generic type.

Apply:

   return useMutation<
     { progressId: string; message: string },
     Error,
     { file: File; metadata: UploadMetadata },
-    {
-      previousSummaries?: Array<[readonly unknown[], KnowledgeItemsResponse | undefined]>;
-      previousOperations?: ActiveOperationsResponse;
-      tempProgressId: string;
-    }
+    {
+      previousSummaries?: Array<[readonly unknown[], KnowledgeItemsResponse | undefined]>;
+      previousOperations?: ActiveOperationsResponse;
+      tempProgressId: string;
+      tempItemId: string;
+    }
   >({
@@
-      return { previousSummaries, previousOperations, tempProgressId, tempItemId: tempProgressId };
+      return { previousSummaries, previousOperations, tempProgressId, tempItemId: tempProgressId };

Also applies to: 410-411

archon-ui-main/src/features/knowledge/components/LevelSelector.tsx (1)

86-110: Fix radiogroup keyboard accessibility (roving tabindex + arrow keys)

  • When no value is selected, all items get tabIndex -1 → group is unreachable by keyboard.
  • Arrow-key navigation (Left/Right/Up/Down) is expected for radios but not implemented.

Apply:

-      <div className="grid grid-cols-2 sm:grid-cols-4 gap-3" role="radiogroup" aria-labelledby="crawl-depth-label">
-        {LEVELS.map((level) => {
+      <div className="grid grid-cols-2 sm:grid-cols-4 gap-3" role="radiogroup" aria-labelledby="crawl-depth-label">
+        {LEVELS.map((level, idx) => {
           const isSelected = value === level.value;
@@
-                  tabIndex={isSelected ? 0 : -1}
-                  onKeyDown={(e) => {
-                    if (e.key === "Enter" || e.key === " ") {
+                  tabIndex={disabled ? -1 : isSelected || (!value && idx === 0) ? 0 : -1}
+                  onKeyDown={(e) => {
+                    if (e.key === "Enter" || e.key === " ") {
                       e.preventDefault();
                       if (!disabled) onValueChange(level.value);
-                    }
+                    } else if (!disabled && (e.key === "ArrowRight" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowUp")) {
+                      e.preventDefault();
+                      const current = LEVELS.findIndex(l => l.value === value);
+                      const delta = (e.key === "ArrowRight" || e.key === "ArrowDown") ? 1 : -1;
+                      const next = current >= 0 ? (current + delta + LEVELS.length) % LEVELS.length : 0;
+                      onValueChange(LEVELS[next].value);
+                    }
                   }}
🧹 Nitpick comments (10)
archon-ui-main/src/features/knowledge/inspector/components/InspectorSidebar.tsx (1)

105-108: Remove redundant dark mode classes with identical values.

Lines 105 and 107 specify dark mode variants that are identical to the light mode values. In Tailwind CSS, when a dark mode class has the same value as its light mode counterpart, the dark: prefix is unnecessary since the light mode value already applies to both modes.

Apply this diff to remove the redundant classes:

                 className={cn(
                   "w-full text-left p-3 rounded-lg mb-1 transition-all",
-                  "hover:bg-white/5 dark:hover:bg-white/5 focus:outline-none focus:ring-2 focus:ring-cyan-500/50",
+                  "hover:bg-white/5 focus:outline-none focus:ring-2 focus:ring-cyan-500/50",
                   selectedItemId === item.id
-                    ? "bg-cyan-500/10 dark:bg-cyan-500/10 border border-cyan-500/30 dark:border-cyan-500/30 ring-1 ring-cyan-500/20"
+                    ? "bg-cyan-500/10 border border-cyan-500/30 ring-1 ring-cyan-500/20"
                     : "border border-transparent",
                 )}
archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts (1)

231-233: Context now returns tempItemId; verify downstream usage

Looks good. Ensure UI consumers expecting tempItemId read it from the mutation context (and not just tempProgressId). Otherwise, consider removing to avoid confusion.

archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx (2)

191-201: Prefer Button variants over heavy class overrides

Use the existing Button variant="default" and only add width. Keeps style centralized and consistent.

Apply:

-            <Button
-              onClick={handleCrawl}
-              disabled={isProcessing || !crawlUrl}
-              className={[
-                "w-full bg-gradient-to-r from-cyan-500 to-cyan-600",
-                "hover:from-cyan-600 hover:to-cyan-700",
-                "backdrop-blur-md border border-cyan-400/50",
-                "shadow-[0_0_20px_rgba(6,182,212,0.25)] hover:shadow-[0_0_30px_rgba(6,182,212,0.35)]",
-                "transition-all duration-200",
-              ].join(" ")}
-            >
+            <Button
+              onClick={handleCrawl}
+              disabled={isProcessing || !crawlUrl}
+              variant="default"
+              className="w-full"
+            >

As per coding guidelines


281-287: Align Upload button with Button variant

Use variant="knowledge" and keep className minimal for width.

Apply:

-            <Button
-              onClick={handleUpload}
-              disabled={isProcessing || !selectedFile}
-              className={[
-                "w-full bg-gradient-to-r from-purple-500 to-purple-600",
-                "hover:from-purple-600 hover:to-purple-700",
-                "backdrop-blur-md border border-purple-400/50",
-                "shadow-[0_0_20px_rgba(147,51,234,0.25)] hover:shadow-[0_0_30px_rgba(147,51,234,0.35)]",
-                "transition-all duration-200",
-              ].join(" ")}
-            >
+            <Button
+              onClick={handleUpload}
+              disabled={isProcessing || !selectedFile}
+              variant="knowledge"
+              className="w-full"
+            >

As per coding guidelines

archon-ui-main/src/features/knowledge/components/KnowledgeHeader.tsx (2)

57-63: Add accessible label and use type="search"

Improve a11y: provide an explicit label and appropriate input type.

Apply:

-          <Input
-            type="text"
+          <Input
+            type="search"
             placeholder="Search knowledge base..."
             value={searchQuery}
             onChange={(e) => onSearchChange(e.target.value)}
-            className="pl-10 bg-black/30 dark:bg-black/30 border-white/10 dark:border-white/10 focus:border-cyan-500/50"
+            aria-label="Search knowledge"
+            className="pl-10 bg-black/30 dark:bg-black/30 border-white/10 dark:border-white/10 focus:border-cyan-500/50"
           />

As per coding guidelines


46-49: Button text clarity

Consider “Add Knowledge” for clarity.

Apply:

-        <Button variant="knowledge" onClick={onAddKnowledge} className="shadow-lg shadow-purple-500/30 flex-shrink-0">
-          <Plus className="w-4 h-4 mr-2" />
-          Knowledge
-        </Button>
+        <Button variant="knowledge" onClick={onAddKnowledge} className="shadow-lg shadow-purple-500/30 flex-shrink-0">
+          <Plus className="w-4 h-4 mr-2" />
+          Add Knowledge
+        </Button>
archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx (1)

94-101: Optional: add scope to header cells for table a11y

Add scope="col" to th elements.

Apply:

-              <th className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Title</th>
-              <th className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Type</th>
-              <th className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Source</th>
-              <th className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Docs</th>
-              <th className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Examples</th>
-              <th className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Created</th>
-              <th className="px-4 py-3 text-right text-sm font-medium text-gray-700 dark:text-gray-300">Actions</th>
+              <th scope="col" className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Title</th>
+              <th scope="col" className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Type</th>
+              <th scope="col" className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Source</th>
+              <th scope="col" className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Docs</th>
+              <th scope="col" className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Examples</th>
+              <th scope="col" className="px-4 py-3 text-left text-sm font-medium text-gray-700 dark:text-gray-300">Created</th>
+              <th scope="col" className="px-4 py-3 text-right text-sm font-medium text-gray-700 dark:text-gray-300">Actions</th>
archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx (1)

195-199: Use cn instead of join for className arrays

For consistency with primitives, prefer cn.

Apply:

-                className={[
-                  "inline-flex items-center gap-1 text-xs mt-2",
-                  "text-gray-600 dark:text-gray-400 hover:text-cyan-600 dark:hover:text-cyan-400 transition-colors",
-                ].join(" ")}
+                className={cn(
+                  "inline-flex items-center gap-1 text-xs mt-2",
+                  "text-gray-600 dark:text-gray-400 hover:text-cyan-600 dark:hover:text-cyan-400 transition-colors",
+                )}

As per coding guidelines

archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx (2)

109-113: Prefer cn helper over array join for classNames

For consistency with primitives, use cn(...) instead of [].join(" ").

-                  <span
-                    className={[
-                      "px-2 py-0.5 bg-green-500/10 text-green-600 dark:text-green-400",
-                      "text-xs font-mono rounded flex-shrink-0",
-                    ].join(" ")}
-                  >
+                  <span
+                    className={cn(
+                      "px-2 py-0.5 bg-green-500/10 text-green-600 dark:text-green-400",
+                      "text-xs font-mono rounded flex-shrink-0",
+                    )}
+                  >

Also add (top of file):

+import { cn } from "../../../ui/primitives/styles";

46-46: Silence console noise in production

Guard console.error to avoid noisy logs in prod builds.

-      console.error("Prism highlighting failed:", error);
+      if (process.env.NODE_ENV !== "production") {
+        // eslint-disable-next-line no-console
+        console.error("Prism highlighting failed:", error);
+      }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ad1fb0 and 691adcc.

⛔ Files ignored due to path filters (1)
  • archon-ui-main/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (19)
  • archon-ui-main/package.json (1 hunks)
  • archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx (6 hunks)
  • archon-ui-main/src/features/knowledge/components/DocumentBrowser.tsx (0 hunks)
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx (7 hunks)
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardTags.tsx (4 hunks)
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardType.tsx (2 hunks)
  • archon-ui-main/src/features/knowledge/components/KnowledgeHeader.tsx (2 hunks)
  • archon-ui-main/src/features/knowledge/components/KnowledgeList.tsx (2 hunks)
  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx (1 hunks)
  • archon-ui-main/src/features/knowledge/components/KnowledgeTypeSelector.tsx (4 hunks)
  • archon-ui-main/src/features/knowledge/components/LevelSelector.tsx (3 hunks)
  • archon-ui-main/src/features/knowledge/components/TagInput.tsx (4 hunks)
  • archon-ui-main/src/features/knowledge/components/index.ts (0 hunks)
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts (2 hunks)
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx (5 hunks)
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorHeader.tsx (2 hunks)
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorSidebar.tsx (3 hunks)
  • archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx (2 hunks)
  • archon-ui-main/src/features/ui/primitives/switch.tsx (2 hunks)
💤 Files with no reviewable changes (2)
  • archon-ui-main/src/features/knowledge/components/index.ts
  • archon-ui-main/src/features/knowledge/components/DocumentBrowser.tsx
🧰 Additional context used
📓 Path-based instructions (10)
archon-ui-main/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

archon-ui-main/src/**/*.{ts,tsx}: Frontend TypeScript must use strict mode with no implicit any
Use TanStack Query for all data fetching; avoid prop drilling
Use database values directly in the frontend; avoid mapping layers between BE and FE types

Never return null to indicate failure in frontend TypeScript; throw errors with details instead

Files:

  • archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeList.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardTags.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTypeSelector.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorSidebar.tsx
  • archon-ui-main/src/features/knowledge/components/TagInput.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardType.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorHeader.tsx
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx
  • archon-ui-main/src/features/knowledge/components/LevelSelector.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeHeader.tsx
  • archon-ui-main/src/features/ui/primitives/switch.tsx
archon-ui-main/src/features/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome in features: 120 character line length, double quotes, and trailing commas

Use Biome formatting/conventions in features (120 char lines, double quotes, trailing commas)

Files:

  • archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeList.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardTags.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTypeSelector.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorSidebar.tsx
  • archon-ui-main/src/features/knowledge/components/TagInput.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardType.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorHeader.tsx
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx
  • archon-ui-main/src/features/knowledge/components/LevelSelector.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeHeader.tsx
  • archon-ui-main/src/features/ui/primitives/switch.tsx
archon-ui-main/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use ESLint rules for legacy frontend code outside /src/features

Files:

  • archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeList.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardTags.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTypeSelector.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorSidebar.tsx
  • archon-ui-main/src/features/knowledge/components/TagInput.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardType.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorHeader.tsx
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx
  • archon-ui-main/src/features/knowledge/components/LevelSelector.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeHeader.tsx
  • archon-ui-main/src/features/ui/primitives/switch.tsx
archon-ui-main/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

TypeScript strict mode with no implicit any in the frontend

Files:

  • archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeList.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardTags.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTypeSelector.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorSidebar.tsx
  • archon-ui-main/src/features/knowledge/components/TagInput.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardType.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorHeader.tsx
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx
  • archon-ui-main/src/features/knowledge/components/LevelSelector.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeHeader.tsx
  • archon-ui-main/src/features/ui/primitives/switch.tsx
archon-ui-main/src/features/**/*.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

Ensure no dynamic Tailwind class construction (avoid runtime-generated class strings)

Files:

  • archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeList.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardTags.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTypeSelector.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorSidebar.tsx
  • archon-ui-main/src/features/knowledge/components/TagInput.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardType.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorHeader.tsx
  • archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx
  • archon-ui-main/src/features/knowledge/components/LevelSelector.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeHeader.tsx
  • archon-ui-main/src/features/ui/primitives/switch.tsx
archon-ui-main/src/features/*/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Place new UI components under src/features/[feature]/components

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeList.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardTags.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTypeSelector.tsx
  • archon-ui-main/src/features/knowledge/components/TagInput.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardType.tsx
  • archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx
  • archon-ui-main/src/features/knowledge/components/LevelSelector.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeHeader.tsx
archon-ui-main/src/features/**/components/**/*.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

archon-ui-main/src/features/**/components/**/*.tsx: Create UI components under src/features/[feature]/components/ using Radix UI primitives from src/features/ui/primitives/
Apply Tron-inspired glassmorphism styling with Tailwind and follow responsive (mobile-first) patterns

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeList.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardTags.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTypeSelector.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorSidebar.tsx
  • archon-ui-main/src/features/knowledge/components/TagInput.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCardType.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/InspectorHeader.tsx
  • archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx
  • archon-ui-main/src/features/knowledge/components/LevelSelector.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeHeader.tsx
archon-ui-main/src/features/*/hooks/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use feature-scoped TanStack Query hooks in src/features/[feature]/hooks

Files:

  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
archon-ui-main/src/features/**/hooks/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use TanStack Query hooks from src/features/[feature]/hooks/ for data fetching

Files:

  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
archon-ui-main/src/features/ui/primitives/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Radix UI primitives from src/features/ui/primitives when creating UI components

Files:

  • archon-ui-main/src/features/ui/primitives/switch.tsx
🧠 Learnings (1)
📚 Learning: 2025-10-10T01:22:49.036Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-10T01:22:49.036Z
Learning: Applies to archon-ui-main/src/features/**/*.tsx : Ensure no dynamic Tailwind class construction (avoid runtime-generated class strings)

Applied to files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeCardTags.tsx
🧬 Code graph analysis (7)
archon-ui-main/src/features/knowledge/components/KnowledgeTypeSelector.tsx (1)
archon-ui-main/src/features/ui/primitives/styles.ts (2)
  • glassCard (122-566)
  • cn (605-607)
archon-ui-main/src/features/knowledge/components/TagInput.tsx (1)
archon-ui-main/src/features/ui/primitives/styles.ts (2)
  • cn (605-607)
  • glassCard (122-566)
archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx (2)
archon-ui-main/src/features/ui/primitives/tabs.tsx (2)
  • TabsList (9-23)
  • TabsTrigger (29-101)
archon-ui-main/src/features/ui/primitives/styles.ts (2)
  • cn (605-607)
  • glassCard (122-566)
archon-ui-main/src/features/knowledge/components/LevelSelector.tsx (2)
archon-ui-main/src/features/ui/primitives/tooltip.tsx (3)
  • Tooltip (9-9)
  • TooltipTrigger (12-12)
  • TooltipContent (15-50)
archon-ui-main/src/features/ui/primitives/styles.ts (2)
  • glassCard (122-566)
  • cn (605-607)
archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx (3)
archon-ui-main/src/features/ui/primitives/styles.ts (1)
  • cn (605-607)
archon-ui-main/src/features/ui/primitives/button.tsx (1)
  • Button (11-130)
archon-ui-main/src/features/ui/primitives/dropdown-menu.tsx (5)
  • DropdownMenu (7-7)
  • DropdownMenuTrigger (8-8)
  • DropdownMenuContent (15-42)
  • DropdownMenuItem (46-69)
  • DropdownMenuSeparator (143-152)
archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx (3)
archon-ui-main/src/features/ui/primitives/styles.ts (1)
  • cn (605-607)
archon-ui-main/src/features/ui/primitives/data-card.tsx (4)
  • DataCard (21-103)
  • DataCardHeader (108-116)
  • DataCardContent (121-129)
  • DataCardFooter (134-149)
archon-ui-main/src/features/progress/components/KnowledgeCardProgress.tsx (1)
  • KnowledgeCardProgress (16-134)
archon-ui-main/src/features/knowledge/components/KnowledgeHeader.tsx (4)
archon-ui-main/src/features/ui/primitives/button.tsx (1)
  • Button (11-130)
archon-ui-main/src/features/ui/primitives/input.tsx (1)
  • Input (8-29)
archon-ui-main/src/features/ui/primitives/toggle-group.tsx (2)
  • ToggleGroup (14-30)
  • ToggleGroupItem (37-61)
archon-ui-main/src/features/ui/primitives/styles.ts (1)
  • cn (605-607)
🪛 ast-grep (0.39.6)
archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx

[warning] 195-195: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation [REFERENCES]
- https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
- https://cwe.mitre.org/data/definitions/79.html

(react-unsafe-html-injection)

🔇 Additional comments (24)
archon-ui-main/src/features/knowledge/inspector/components/InspectorSidebar.tsx (1)

131-131: LGTM! Dark mode color adjustments improve readability.

The language badge (line 131) and Load More button (line 160) now use lighter color variants in dark mode (text-green-400, text-cyan-400) compared to light mode (text-green-600, text-cyan-600), which provides better contrast and readability on dark backgrounds.

Also applies to: 160-160

archon-ui-main/src/features/ui/primitives/switch.tsx (2)

108-122: ForwardRef props/ref separation LGTM

Clean split of props and ref. Destructuring checked/defaultChecked/onCheckedChange ensures {...props} won’t override controlled state handlers. Order of props is safe.


145-145: Trailing comma aligns with Biome rules

Dependency array formatting is correct and non-behavioral.

archon-ui-main/src/features/knowledge/inspector/components/InspectorHeader.tsx (1)

41-42: LGTM! Dark mode support for badges.

The color updates improve light-mode contrast (darker text) while adding appropriate dark-mode variants. Consistent with the broader UI refactor.

Also applies to: 63-64

archon-ui-main/src/features/knowledge/components/KnowledgeTypeSelector.tsx (1)

67-97: LGTM! Centralized glassCard styling with edge-lit selection.

The refactor successfully replaces explicit gradients/borders with glassCard tokens. The edge-lit effects (top border line + vertical glow) provide clear visual feedback for the selected state, consistent with UI_STANDARDS.md.

archon-ui-main/src/features/knowledge/components/KnowledgeCardTags.tsx (1)

218-221: LGTM! Formatting for readability.

The array.join(" ") pattern improves readability without violating the "no dynamic Tailwind class construction" guideline. All classes remain static strings (not runtime-generated), which ensures Tailwind's purge/tree-shaking works correctly.

Based on coding guidelines.

Also applies to: 261-264, 331-336, 352-355, 363-366

archon-ui-main/src/features/knowledge/components/KnowledgeList.tsx (1)

110-110: LGTM! Dark mode support for alert states.

The dark mode variants maintain consistent visual hierarchy in both themes.

Also applies to: 133-133

archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx (2)

144-144: LGTM! Dark mode support for status indicator.

The dark mode variant maintains the animated pulse effect in both themes.


76-76: Redundant op.error fallback removed – safe to drop: ActiveOperation defines only a mandatory message and no error field, so all error details flow through message.

archon-ui-main/src/features/knowledge/components/KnowledgeCardType.tsx (1)

75-76: LGTM! Updated color scheme with dark mode support.

The color updates (cyan for technical, purple for business) align with the broader UI refactor and match the scheme used in KnowledgeTypeSelector.tsx. Dark mode variants ensure proper contrast in both themes.

Also applies to: 114-115

archon-ui-main/src/features/knowledge/components/TagInput.tsx (4)

78-83: LGTM! Improved UX with inline help text.

Moving the help text to the header makes it more discoverable than placing it below the input. The compact instruction format is clear and actionable.


88-114: LGTM! Centralized glassCard styling for tag chips.

The refactor correctly applies glassCard tokens (blur.md, tints.blue.medium) and improves the React key from array index to tag value, which is better for reconciliation when tags are reordered or removed. The aria-hidden on the icon is correct since the button has an aria-label.


130-136: LGTM! Consistent glassCard styling for input field.

The input styling now uses centralized glassCard tokens, maintaining consistency with other refactored components.


139-144: LGTM! Helpful tag count display.

The tag count provides useful feedback on usage limits.

archon-ui-main/package.json (1)

52-52: No action needed—prismjs ^1.30.0 includes patches for all known advisories (DOM clobbering and XSS fixed in 1.30.0).

archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx (2)

137-147: Tabs migration LGTM

Adoption of TabsList/TabsTrigger with icons is clean and accessible. Good use of primitives and consistent styling.


168-173: Input glass styles integration looks good

Using glassCard blur/transparency with cn keeps classes static and purge-safe. No issues.

archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx (3)

83-90: Edge color mapping logic is clear and minimal

Good, maps state to constrained edge colors supported by DataCard/glassCard.


124-133: Optimistic and hover states look good

Use of ring on optimistic and subtle hover shadow is consistent with the glass theme.


93-99: No action needed: 'yellow' accentColor is supported
The accentColor prop union includes "yellow", and both ICON_COLOR_CLASSES and TOOLTIP_COLOR_CLASSES define a "yellow" entry.

archon-ui-main/src/features/knowledge/components/LevelSelector.tsx (3)

69-81: LGTM on structured Tooltip around label

Consistent primitives usage, accessible button trigger, and concise content. Looks good.


112-119: Styling modernization looks solid

Good adoption of glassCard tokens and focus-visible rings. Selection/disabled states are clear and consistent with UI standards.


9-9: SimpleTooltip import valid SimpleTooltip is exported from ui/primitives/tooltip.tsx; no action required.

archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx (1)

163-176: Markdown rendering is secure ReactMarkdown is used without rehypeRaw/allowDangerousHtml, so HTML is escaped by default. No sanitization plugin is required unless raw HTML support is added later.

Comment thread archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx (1)

148-166: Protocol restriction implemented; consider icon and color refinement.

The unsafe protocol concern has been addressed—non-http(s) URLs are now rendered as plain text instead of clickable links. However, the implementation deviates slightly from the previous suggestion:

  1. Both safe and unsafe protocols use the ExternalLink icon, which may be misleading for non-clickable items
  2. The unsafe case lacks the muted text color (text-gray-500 dark:text-gray-400)

Consider this refinement for visual clarity:

                   ) : (
-                     <span className="inline-flex items-center gap-1">
-                       <ExternalLink className="w-3.5 h-3.5" />
+                     <span className="inline-flex items-center gap-1 text-gray-500 dark:text-gray-400">
+                       <FileText className="w-3.5 h-3.5" />
                        <span className="truncate inline-block">{getHostname(item.url)}</span>
                      </span>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 691adcc and e22c6c3.

📒 Files selected for processing (2)
  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx (1 hunks)
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx (5 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
archon-ui-main/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

archon-ui-main/src/**/*.{ts,tsx}: Frontend TypeScript must use strict mode with no implicit any
Use TanStack Query for all data fetching; avoid prop drilling
Use database values directly in the frontend; avoid mapping layers between BE and FE types

Never return null to indicate failure in frontend TypeScript; throw errors with details instead

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
archon-ui-main/src/features/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome in features: 120 character line length, double quotes, and trailing commas

Use Biome formatting/conventions in features (120 char lines, double quotes, trailing commas)

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
archon-ui-main/src/features/*/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Place new UI components under src/features/[feature]/components

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
archon-ui-main/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use ESLint rules for legacy frontend code outside /src/features

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
archon-ui-main/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

TypeScript strict mode with no implicit any in the frontend

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
archon-ui-main/src/features/**/components/**/*.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

archon-ui-main/src/features/**/components/**/*.tsx: Create UI components under src/features/[feature]/components/ using Radix UI primitives from src/features/ui/primitives/
Apply Tron-inspired glassmorphism styling with Tailwind and follow responsive (mobile-first) patterns

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
archon-ui-main/src/features/**/*.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

Ensure no dynamic Tailwind class construction (avoid runtime-generated class strings)

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx
  • archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx
🧬 Code graph analysis (1)
archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx (3)
archon-ui-main/src/features/ui/primitives/styles.ts (1)
  • cn (605-607)
archon-ui-main/src/features/ui/primitives/button.tsx (1)
  • Button (11-130)
archon-ui-main/src/features/ui/primitives/dropdown-menu.tsx (5)
  • DropdownMenu (7-7)
  • DropdownMenuTrigger (8-8)
  • DropdownMenuContent (15-42)
  • DropdownMenuItem (46-69)
  • DropdownMenuSeparator (143-152)
🪛 ast-grep (0.39.6)
archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx

[warning] 202-202: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation [REFERENCES]
- https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
- https://cwe.mitre.org/data/definitions/79.html

(react-unsafe-html-injection)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Backend Tests (Python + pytest)
🔇 Additional comments (9)
archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx (2)

68-95: LGTM: Safe helper functions with proper error handling.

All three utility functions implement correct error handling patterns:

  • getHostname: Safe URL parsing with fallback to the original string
  • isSafeProtocol: Validates http/https protocols with false as the safe default
  • formatCreatedDate: Guards against invalid dates and returns "N/A" on error

No null returns, proper try-catch blocks, and sensible defaults throughout.


97-229: LGTM: Well-structured table with comprehensive dark mode support.

The table implementation demonstrates solid practices:

  • Responsive layout with overflow handling
  • Dark mode variants across all elements (headers, rows, cells, actions)
  • Static Tailwind classes throughout (no dynamic class construction)
  • Per-row isDeleting state provides clear UX feedback
  • Proper use of UI primitives (Button, DropdownMenu) from the centralized library
  • Accessible actions with keyboard navigation support

The zebra striping (line 121) correctly uses static class strings selected by ternary, which complies with the Tailwind guidelines.

archon-ui-main/src/features/knowledge/inspector/components/ContentViewer.tsx (7)

39-57: Security concern properly addressed.

The previous review flagged XSS risk with dangerouslySetInnerHTML, but this implementation correctly addresses it by escaping HTML entities before passing to Prism (lines 44-47), which is the recommended approach per Prism documentation. The error fallback (line 55) also escapes properly.

This approach is superior to post-sanitization because it prevents injection at the source. Based on learnings.


59-82: LGTM!

The backtick-stripping logic correctly handles markdown code blocks with and without language identifiers, including edge cases where backticks lack surrounding newlines.


115-119: LGTM!

The array-join pattern for organizing class names is acceptable and does not violate the "no dynamic Tailwind class construction" guideline, as all classes are static strings known at compile time.


169-184: LGTM!

ReactMarkdown is used correctly with custom component styling and no raw HTML rendering. The implementation follows react-markdown v10.x best practices by using the children prop and providing safe component overrides.


186-210: LGTM!

The code highlighting implementation is secure because highlightCode pre-escapes HTML entities before Prism processing (as reviewed earlier). The IIFE pattern for extracting language once is clean, and the class names are statically defined.


224-236: LGTM!

The conditional URL rendering includes proper null-safe checks and uses target="_blank" with rel="noopener noreferrer" for secure external links.


7-19: prismjs@^1.30.0 is already installed, addressing DOM-clobbering and XSS advisories.

@sean-esk sean-esk merged commit 94e28f8 into main Oct 10, 2025
8 checks passed
@sean-esk sean-esk deleted the refactor/knowledge-ui branch October 10, 2025 21:07
sean-esk pushed a commit that referenced this pull request Oct 10, 2025
Merged in PR #776 (refactor/knowledge-ui) from main.
No conflicts - different features.
leonj1 pushed a commit to leonj1/Archon that referenced this pull request Oct 13, 2025
Refactoring the UI for consistent styling
leonj1 pushed a commit to leonj1/Archon that referenced this pull request Oct 13, 2025
Merged in PR coleam00#776 (refactor/knowledge-ui) from main.
No conflicts - different features.
coleam00 pushed a commit that referenced this pull request Apr 7, 2026
…#776)

* feat: add archon-refactor-safely workflow + Windows/persistence fixes

- Add bundled archon-refactor-safely workflow: 8-phase DAG that safely
  decomposes large files (scan → impact analysis → plan → execute with
  type-check hooks → validate → fix failures → verify behavior → PR)
- Extract getProcessUid() from ClaudeClient for cross-platform compat
  (process.getuid exists as non-function on Windows, crashing optional chaining)
- Fix terminal tool calls not finalized in MessagePersistence flush:
  pre-finalize last tool in each segment before ready/pending split so
  segments with completed-but-unflushed tools are not stuck as pending
- Remove dead worktree limit tests (no implementation exists on dev)

* fix: address review findings for refactor-safely PR

- Remove dead hooks spread in claude.ts (overridden by later explicit key)
- Fix verify-behavior node referencing Bash when denied_tools blocks it
- Add regression test for terminal tool call pre-finalization in flush()
- Add test for Windows getProcessUid (undefined return) path
- Add warn log for unmatched tool results in appendToolResult
- Improve persistence.ts comment precision about in-flight predicate
- Remove dead pending spread in no-dbId restore path
- Add archon-refactor-safely to docs/getting-started.md workflow table
- Fix stale worktree limit references in orchestration research doc
Tyone88 pushed a commit to Tyone88/Archon that referenced this pull request Apr 16, 2026
…coleam00#776)

* feat: add archon-refactor-safely workflow + Windows/persistence fixes

- Add bundled archon-refactor-safely workflow: 8-phase DAG that safely
  decomposes large files (scan → impact analysis → plan → execute with
  type-check hooks → validate → fix failures → verify behavior → PR)
- Extract getProcessUid() from ClaudeClient for cross-platform compat
  (process.getuid exists as non-function on Windows, crashing optional chaining)
- Fix terminal tool calls not finalized in MessagePersistence flush:
  pre-finalize last tool in each segment before ready/pending split so
  segments with completed-but-unflushed tools are not stuck as pending
- Remove dead worktree limit tests (no implementation exists on dev)

* fix: address review findings for refactor-safely PR

- Remove dead hooks spread in claude.ts (overridden by later explicit key)
- Fix verify-behavior node referencing Bash when denied_tools blocks it
- Add regression test for terminal tool call pre-finalization in flush()
- Add test for Windows getProcessUid (undefined return) path
- Add warn log for unmatched tool results in appendToolResult
- Improve persistence.ts comment precision about in-flight predicate
- Remove dead pending spread in no-dbId restore path
- Add archon-refactor-safely to docs/getting-started.md workflow table
- Fix stale worktree limit references in orchestration research doc
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
…coleam00#776)

* feat: add archon-refactor-safely workflow + Windows/persistence fixes

- Add bundled archon-refactor-safely workflow: 8-phase DAG that safely
  decomposes large files (scan → impact analysis → plan → execute with
  type-check hooks → validate → fix failures → verify behavior → PR)
- Extract getProcessUid() from ClaudeClient for cross-platform compat
  (process.getuid exists as non-function on Windows, crashing optional chaining)
- Fix terminal tool calls not finalized in MessagePersistence flush:
  pre-finalize last tool in each segment before ready/pending split so
  segments with completed-but-unflushed tools are not stuck as pending
- Remove dead worktree limit tests (no implementation exists on dev)

* fix: address review findings for refactor-safely PR

- Remove dead hooks spread in claude.ts (overridden by later explicit key)
- Fix verify-behavior node referencing Bash when denied_tools blocks it
- Add regression test for terminal tool call pre-finalization in flush()
- Add test for Windows getProcessUid (undefined return) path
- Add warn log for unmatched tool results in appendToolResult
- Improve persistence.ts comment precision about in-flight predicate
- Remove dead pending spread in no-dbId restore path
- Add archon-refactor-safely to docs/getting-started.md workflow table
- Fix stale worktree limit references in orchestration research doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant